package com.mob.tools.log;

import android.content.Context;
import android.text.TextUtils;
import java.util.HashMap;

public class LogPrinter
{
  private HashMap<String, LogCollector> collectors = new HashMap();
  private String packageName = "";
  private String scope = "";

  private String getScope(Thread paramThread)
  {
    StackTraceElement[] arrayOfStackTraceElement = paramThread.getStackTrace();
    if ((arrayOfStackTraceElement != null) && (arrayOfStackTraceElement.length > 0))
    {
      StackTraceElement localStackTraceElement = arrayOfStackTraceElement[(-1 + arrayOfStackTraceElement.length)];
      String str1 = localStackTraceElement.getFileName();
      if ((str1 == null) || (str1.length() <= 0));
      for (String str2 = localStackTraceElement.getClassName(); ; str2 = this.scope + "/" + str1)
      {
        int i = localStackTraceElement.getLineNumber();
        String str3 = String.valueOf(i);
        if (i < 0)
        {
          str3 = localStackTraceElement.getMethodName();
          if ((str3 == null) || (str3.length() <= 0))
            str3 = "Unknown Source";
        }
        return str2 + "(" + str3 + ")";
      }
    }
    return this.scope;
  }

  private String processMessage(Thread paramThread, String paramString)
  {
    Object[] arrayOfObject = new Object[2];
    arrayOfObject[0] = paramThread.getName();
    arrayOfObject[1] = paramString;
    return String.format("%s %s", arrayOfObject);
  }

  public void nativeCrashLog(String paramString1, String paramString2)
  {
    LogCollector localLogCollector = (LogCollector)this.collectors.get(paramString1);
    if (localLogCollector != null)
      localLogCollector.log(paramString1, 6, 2, this.scope, paramString2);
  }

  public int println(String paramString1, int paramInt1, int paramInt2, String paramString2)
  {
    Thread localThread = Thread.currentThread();
    String str1 = processMessage(localThread, paramString2);
    String str2 = getScope(localThread);
    LogCollector localLogCollector = (LogCollector)this.collectors.get(paramString1);
    if (localLogCollector != null)
      localLogCollector.log(paramString1, paramInt1, paramInt2, str2, str1);
    return 0;
  }

  public void setCollector(String paramString, LogCollector paramLogCollector)
  {
    this.collectors.put(paramString, paramLogCollector);
  }

  public void setContext(Context paramContext)
  {
    this.packageName = paramContext.getPackageName();
    if (TextUtils.isEmpty(this.packageName))
    {
      this.packageName = "";
      return;
    }
    this.scope = this.packageName;
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.mob.tools.log.LogPrinter
 * JD-Core Version:    0.6.2
 */